package study_webservice;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

public class test {
    public static void main(String[] args) throws Exception {
        //方式1 排除 hello-spring-boot\lib jar包与方法2冲突
        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        Client client1 = dcf.createClient("http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl");
        try {
            Object[] getMobileCodeInfos = client1.invoke("getMobileCodeInfo", "13151071326", "");
            System.out.println(getMobileCodeInfos[0]);
        } catch (Exception e) {
            e.printStackTrace();
        }

        //方式2
//        MobileCodeWS ws = new MobileCodeWSLocator();
//        MobileCodeWSSoap_PortType mobileCodeWSSoap12 = ws.getMobileCodeWSSoap12();
//        String[] databaseInfo = mobileCodeWSSoap12.getDatabaseInfo();
//        for (String s : databaseInfo) {
//            System.out.println(s);
//        }
//        String mobileCodeInfo = mobileCodeWSSoap12.getMobileCodeInfo("13151071326", "");
//        System.out.println(mobileCodeInfo);
    }
}
